package com.atguigu.yygh.apartment.service.impl;

import com.atguigu.yygh.apartment.mapper.ApartmentMapper;
import com.atguigu.yygh.apartment.service.ApartmentService;
import com.atguigu.yygh.model.hosp.Apartment;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ApartmentServiceImpl extends ServiceImpl<ApartmentMapper, Apartment> implements ApartmentService {

    @Override
    public String getSignKey(String apartmentCode) {
        QueryWrapper<Apartment> wrapper = new QueryWrapper<>();
        wrapper.eq("apartment_code",apartmentCode);
        Apartment apartment = baseMapper.selectOne(wrapper);
        return apartment.getSignKey();
    }

    @Override
    public String getApartmentName(String apartmentCode) {
        QueryWrapper<Apartment> wrapper = new QueryWrapper<>();
        wrapper.eq("apartment_code",apartmentCode);
        Apartment apartment = baseMapper.selectOne(wrapper);
        return apartment.getApartmentName();
    }
}
